package com.itheima.controller;

import com.itheima.feign.UserClient;
import com.itheima.pojo.User;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping(value = "/feign")
public class UserController {
    @Autowired
    private UserClient userClient;

    @GetMapping(value = "/{id}")
    public User findById(@PathVariable(value = "id") Integer id) {
        User user = userClient.findById(id);
        return user;
    }
}
